home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Windows Selection / Windows Selection 1.iso / Graphics / Formula Graphics Multimedia System / GAME_4.SXT < prev    next >
Encoding:
Text File  |  1996-04-02  |  841 b   |  35 lines

  1. /////////////////////////////
  2. // Harrow Software 96
  3. // Cannon shot definition
  4. //
  5.  
  6. message "Please execute game_1.sxt"
  7. return
  8.  
  9. initialize: my_sprite, my_bitmaps, xpos,ypos,u,v
  10.     frame_pos = 0
  11.     exploding = 0
  12.  
  13. update_sprite:
  14.     // get the current frame
  15.     my_bitmap = my_bitmaps get frame_pos
  16.     xmid = my_bitmap.xlen/2        // get offset from center
  17.     ymid = my_bitmap.ylen/2
  18.  
  19.     sprite my_sprite bitmap my_bitmap at xpos-xmid, ypos-ymid depth ypos
  20.  
  21.     // if the last frame of animation has played then finish
  22.     if exploding then frame_pos = frame_pos + 1
  23.     if frame_pos >= my_bitmaps.max then return FALSE
  24.  
  25.     xpos = xpos + u    // move the position of the shot
  26.     ypos = ypos + v
  27.  
  28.     // if the shot has flown off the window then end
  29.     if !(in_window xpos,ypos) then return FALSE
  30.     return TRUE
  31.  
  32. explode:
  33.     exploding = TRUE
  34.     frame_pos = 1
  35.